﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Microsoft.WindowsAzure;
using Microsoft.WindowsAzure.Diagnostics;
using Microsoft.WindowsAzure.ServiceRuntime;

namespace Ciripescu_WebRole
{
    public class WebRole : RoleEntryPoint 
    {

        public override bool OnStart()
        {
            DiagnosticMonitorConfiguration dConfig = DiagnosticMonitor.GetDefaultInitialConfiguration();
            dConfig.Directories.ScheduledTransferPeriod = TimeSpan.FromMinutes(15);
            dConfig.Logs.ScheduledTransferPeriod        = TimeSpan.FromMinutes(15);
            
            //dConfig.Logs.BufferQuotaInMB = 1; //1MB
            
            dConfig.WindowsEventLog.ScheduledTransferPeriod = TimeSpan.FromMinutes(15);
            dConfig.WindowsEventLog.DataSources.Add("Application!*");
            dConfig.WindowsEventLog.DataSources.Add("System!*");

            DiagnosticMonitor.Start("DiagnosticsConnectionString",dConfig);
            System.Diagnostics.Trace.TraceInformation("Web role start completed");
            
            return base.OnStart();
        }
    }
}
